package com.sinaapp.gavinzhang.jianzhioffer;

/**
 * 得到一个整数二进制中1的个数
 * Created by gavin on 15-9-4.
 */
public class OneNumbersInInteger {
    public static void main(String[] args)
    {

    }

    public static int getNumbers(int number)
    {
        int count = 0;
        while (number != 0)
        {
            ++count;
            number = (number-1)&number;
        }
        return count;
    }

}
